<template>
	<view class="messagePage myBackground">
		<view v-if="breakdownData.length > 0" class="content pl15 pr15">
			<scroll-view scroll-y class="h100p w100p">
				<view>
					<view class="mb15" v-for="(item,index) in breakdownData" :key="index">
						<view class="content_item p15 boxSizing">
							<view class="itemName pb15">
								<view class="d-flex a-center">
									<view class="line mr5"></view>
									<view>{{item.deviceName}}</view>
								</view>
							</view>
							<view class="my_flex_sb mb15">
								<view class="rowName">扣分类型:</view>
								<view class="rowValue font_red">{{item.pointType}}</view>
							</view>
							<view class="my_flex_sb mb15">
								<view class="rowName">扣分分数:</view>
								<view class="rowValue font_red">-{{item.point}}</view>
							</view>
							<view class="my_flex_sb">
								<view class="rowName">扣分时间:</view>
								<view class="rowValue">{{item.pointTime}}</view>
							</view>
						</view>
					</view>
				</view>
				<view style="height: 10rpx;"></view>
			</scroll-view>
		</view>
		<view v-else class="w100p d-flex-center" style="height: calc(100% - 60px);">
			<noValue></noValue>
		</view>

		<!-- <tab-bar-view :tabCode="'1'"></tab-bar-view> -->
	</view>
</template>

<script>
	// import {
	// 	queryTwoListSafeByReport
	// } from "@/api/dormBuilding/oneBuildOneFloor.js"

	export default {
		data() {
			return {
				breakdownData: [],
				api: null
			};
		},
		onLoad(query) {
			console.log(query.type);
			this.loadModule(query.type)
		},
		onShow() {

		},
		onReady() {
			// 隐藏导航栏
			uni.hideTabBar({});
		},
		onUnload() {

		},
		methods: {
			async loadModule(data) {
				try {
					let module = null
					switch (data) {
						case 'SS-1-1':
							module = await import('@/api/dormBuilding/oneBuildOneFloor.js');
							break;
						case 'SS-1-2':
							module = await import('@/api/dormBuilding/oneBuildTwoFloor.js');
							break;
						case 'SS-1-3':
							module = await import('@/api/dormBuilding/oneBuildThreeFloor.js');
							break;
						case 'SS-1-4':
							module = await import('@/api/dormBuilding/oneBuildFourFloor.js');
							break;
						case 'SS-1-5':
							module = await import('@/api/dormBuilding/oneBuildFiveFloor.js');
							break;
						case 'SS-2-1':
							module = await import('@/api/dormBuilding/twoBuildOneFloor.js');
							break;
						case 'SS-2-2':
							module = await import('@/api/dormBuilding/twoBuildTwoFloor.js');
							break;
						case 'SS-2-3':
							module = await import('@/api/dormBuilding/twoBuildThreeFloor.js');
							break;
						case 'SS-2-4':
							module = await import('@/api/dormBuilding/twoBuildFourFloor.js');
							break;
						case 'SS-2-5':
							module = await import('@/api/dormBuilding/twoBuildFiveFloor.js');
							break;
						case 'SS-3-1':
							module = await import('@/api/dormBuilding/threeBuildOneFloor.js');
							break;
						case 'SS-3-2':
							module = await import('@/api/dormBuilding/threeBuildTwoFloor.js');
							break;
						case 'SS-3-3':
							module = await import('@/api/dormBuilding/threeBuildThreeFloor.js');
							break;
						case 'SS-3-4':
							module = await import('@/api/dormBuilding/threeBuildFourFloor.js');
							break;
						case 'SS-3-5':
							module = await import('@/api/dormBuilding/threeBuildFiveFloor.js');
							break;
						default:
							// 如果 expression 不匹配任何 case 值，则执行 default 子句中的代码块  
							break;
					}
					// 使用模块中的功能
					module.queryTwoListSafeByReport().then(res => {
						let tempData = res.object || []

						this.breakdownData = tempData
					})
				} catch (e) {
					console.error('模块加载失败:', e);
				}
			},
			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5f5f5;
	}

	.messagePage {
		height: calc(100vh - var(--window-top));
		width: 100%;

		.content {
			display: flex;
			flex-direction: column;
			height: calc(100% - 20rpx);
			font-family: Source Han Sans CN, Source Han Sans CN-400;

			.content_item {
				background: #ffffff;
				border-radius: 8px;
				box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.10);
				font-family: "黑体", "Heiti SC", "STHeiti", sans-serif;

				.line {
					width: 12rpx;
					height: 32rpx;
					background: #3276FF;
					border-radius: 3px;
				}

				.itemName {
					font-size: 32upx;
					color: #333333;
					font-weight: 600;
				}


				.rowName {
					font-size: 28upx;
					color: #333333;
				}

				.rowValue {
					font-size: 28upx;
					color: #666666;
				}

				.font_red {
					color: #E14B4B;
				}
			}

			.my_flex_sb:last-child {
				margin-bottom: 0 !important;
			}
		}
	}
</style>